package reflect;

import java.util.ArrayList;
import java.util.Scanner;

public class ReflectDemo2 {
    public static void main(String[] args)throws Exception {
        ArrayList<Object> list = new ArrayList<>();
        System.out.println(list);

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要创建的类的全类名:");
        String className = sc.next();
        Class cls = Class.forName(className);

        Object obj = cls.newInstance();
        System.out.println(obj);
    }
}
